#人生重开模拟器
import random
import sys
import time
print('+----------------------------------------+')
print('+           花有重开日，人无再少年           +')
print('+           欢迎来到人生重开模拟器           +')
print('+----------------------------------------+')
while True:

    while True:
        family_background = int(input('请输入家境度量值(1-10)：'))
        if not 0 < family_background < 11:
            print('家境度量值不在范围(1-10),请重新输入！')
            continue
        else:
            break

    while True:
        appearance = int(input('请输入颜值度量值(1-10)：'))
        if not 0 < appearance < 11:
            print('颜值度量值不在范围(1-10),请重新输入！')
            continue
        else:
            break

    while True:
        intelligence = int(input('请输入智力度量值(1-10)：'))
        if not 0 < intelligence < 11:
            print('智力度量值不在范围(1-10),请重新输入！')
            continue
        else:
            break

    while True:
        physical_constitution = int(input('请输入体质度量值(1-10)：'))
        if not 0 < physical_constitution < 11:
            print('体质度量值不在范围(1-10),请重新输入！')
            continue
        else:
            break
    if family_background + appearance + intelligence + physical_constitution > 20:
        print('总度量值超过20，请重新输入!')
        print('-------------------------------------------------------------------------------------')
        continue
    else:
        print(f'family_background = {family_background}\tappearance = {appearance}\tintelligence = {intelligence}\tphysical_constitution = {physical_constitution}')
        print('-------------------------------------------------------------------------------------')
        break
point = random.randint(1, 6)
if point % 2 == 0:
    gender = 'boy'
else:
    gender = 'girl'
point = random.randint(1, 3)
if family_background == 10:
    print(f'你出生在帝都，你是一个{gender}，父母是高官政要！')
    family_background += 1
    appearance += 1
    intelligence += 1
    physical_constitution += 1
elif 7 <= family_background <= 9:
    string = f'你出生在大城市，你是一个{gender}，'
    if point == 1:
        string += '父母是大学教授！'
        print(string)
        intelligence += 3
    elif point == 2:
        string += '父母是大明星！'
        print(string)
        appearance += 3
    else:
        string += '父母是国际健将！'
        print(string)
        physical_constitution += 3
elif 4 <= family_background <= 6:
    string = f'你出生在三线城市，你是一个{gender}，'
    if point == 1:
        string += '父母是医生！'
        print(string)
        physical_constitution += 1
    elif point == 2:
        string += '父母是模特'
        print(string)
        appearance += 1
    else:
        string += '父母是高中老师'
        print(string)
        intelligence += 1
else:
    string = f'你出生在农村，你是一名{gender},'
    if point == 1:
        string += '父母智力不太正常！'
        print(string)
        intelligence -= 2
    elif point == 2:
        string += '父母是苦农民，家里经常断粮！'
        print(string)
        physical_constitution -= 2
    else:
        string += '父母相貌水平较为底下！'
        print(string)
        appearance -= 2
print(f'family_background = {family_background}\tappearance = {appearance}\tintelligence = {intelligence}\tphysical_constitution = {physical_constitution}')
print('-------------------------------------------------------------------------------------')

#幼年
for age in range(1, 11):
    # 把一整年的打印都整理到一个字符串中, 在这一年的结尾统一打印
    info = f'你今年 {age} 岁. '
    # 生成一个 [1, 3] 的随机整数.
    point = random.randint(1, 3)
    # 接下来编写各种事件的代码
    # 性别触发的事件
    if gender == 'girl' and family_background <= 3 and point == 1:
        info += '你的家里人重男轻女思想非常严重, 你被遗弃了!'
        print(info)
        print('游戏结束!')
        sys.exit(0)
    # 体质触发的事件
    # 使用 elif 是为了保证每年只触发一个事件!
    elif physical_constitution < 6 and point < 3:
        info += '你生了一场病, '
        if family_background >= 5:
            info += '在父母的悉心照料下, 你康复了'
            physical_constitution += 1
            family_background -= 1
        else:
            info += '你的父母没精力管你, 你的身体状况更糟糕了'
            physical_constitution -= 1
    # 颜值触发的时间
    elif appearance <= 4 and age >= 7:
        info += '你长的太丑了, 别的小朋友不喜欢你. '
        if intelligence > 5:
            info += '你决定用学习填充自己!'
            intelligence += 1
        else:
            if gender == 'boy':
                info += '你和别的小朋友经常打架!'
                physical_constitution += 1
                intelligence -= 1
            else:
                info += '你经常被别的小朋友欺负!'
                physical_constitution -= 1
    # 智商触发的事件
    elif intelligence < 5:
        info += '你看起来傻傻的. '
        if family_background >= 8 and age >= 6:
            info += '你的父母把你送到更好的学校学习'
            intelligence += 1
        elif 4 <= family_background <= 7:
            if gender == 'boy':
                info += '你的父母鼓励你多运动, 争取成为运动员'
                physical_constitution += 1
            else:
                info += '你的父母鼓励你多打扮自己'
                appearance += 1
        else:
            # 家境 < 4
            info += '你的父母为此经常吵架'
            if point == 1:
                physical_constitution -= 1
            elif point == 2:
                intelligence -= 1
            else:
                pass
    # 健康成长事件
    else:
        info += '你健康成长. '
        if point == 1:
            info += '你看起来更结实了.'
            physical_constitution += 1
        elif point == 2:
            info += '你看起来更好看了.'
            appearance += 1
        else:
            # 无事发生
            pass

    # 打印这一年发生的事情
    print(info)
    print(f'family_background = {family_background}\tappearance = {appearance}\tintelligence = {intelligence}\tphysical_constitution = {physical_constitution}')
    print('-------------------------------------------------------------------------------------')
    # 为了方便观察, 加一个小小的暂停操作
    time.sleep(2)